import type {baseResponse, optionsType} from "@/api/index";
import {useAxios} from "@/api/index";

export interface statisticType {
    "userCount": number
    "roleCount": number
    "chatCount": number
    "nowChatCount": number
    "nowLoginCount": number
}

export const statisticMap :Record<keyof statisticType, string> = {
    "userCount": "用户总数",
    "roleCount": "角色总数",
    "chatCount": "对话总数",
    "nowChatCount": "今日对话",
    "nowLoginCount": "今日登陆"
}

export function dataStatisticApi(): Promise<baseResponse<statisticType>> {
    return useAxios.get("/api/data/statistic")
}

export interface weatherType {
    "province": string
    "city": string
    "adcode": string
    "weather": string // 天气
    "temperature": string // 温度
    "winddirection": string
    "windpower": string
    "humidity": string
    "reporttime": string
    "temperature_float": string
    "humidity_float": string
}

export function dataWeatherApi(): Promise<baseResponse<weatherType>> {
    return useAxios.get("/api/data/weather")
}

export interface chatStatisticType {
    dateList: string[]
    countList: number[]
}
export function chatStatisticApi(): Promise<baseResponse<chatStatisticType>> {
    return useAxios.get("/api/data/chat_statistic")
}